<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理员面板 - AI简历分析系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <style>
        :root {
            --primary-color: #4e73df;
            --secondary-color: #858796;
            --success-color: #1cc88a;
            --info-color: #36b9cc;
            --warning-color: #f6c23e;
            --danger-color: #e74a3b;
            --light-color: #f8f9fc;
            --dark-color: #5a5c69;
        }

        body {
            font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background-color: #f8f9fc;
        }

        .sidebar {
            background: linear-gradient(180deg, var(--primary-color) 0%, #224abe 100%);
            min-height: 100vh;
            color: white;
            transition: all 0.3s;
        }

        .sidebar .nav-link {
            color: rgba(255, 255, 255, 0.8);
            margin: 5px 0;
            border-radius: 5px;
            padding: 10px 15px;
        }

        .sidebar .nav-link:hover {
            color: white;
            background-color: rgba(255, 255, 255, 0.1);
        }

        .sidebar .nav-link.active {
            color: white;
            background-color: rgba(255, 255, 255, 0.2);
        }

        .sidebar .nav-link i {
            margin-right: 10px;
        }

        .topbar {
            height: 70px;
            box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
            background-color: white;
        }

        .card {
            border: none;
            border-radius: 0.35rem;
            box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
            margin-bottom: 20px;
        }

        .card-header {
            background-color: #f8f9fc;
            border-bottom: 1px solid #e3e6f0;
            padding: 1rem 1.35rem;
            font-weight: 600;
        }

        .stat-card {
            border-left: 0.25rem solid;
            padding: 1rem;
        }

        .stat-card.primary {
            border-left-color: var(--primary-color);
        }

        .stat-card.success {
            border-left-color: var(--success-color);
        }

        .stat-card.warning {
            border-left-color: var(--warning-color);
        }

        .stat-card .stat-number {
            font-size: 1.5rem;
            font-weight: 700;
        }

        .stat-card .stat-text {
            font-size: 0.875rem;
            color: var(--secondary-color);
        }

        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }

        .content-wrapper {
            padding: 20px;
        }

        @media (min-width: 768px) {
            .sidebar {
                width: 14rem !important;
            }
        }
    </style>
</head>
<body>
<div class="d-flex">
    <!-- 侧边栏导航 -->
    <div class="sidebar flex-shrink-0 p-3" style="width: 250px;">
        <div class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-white text-decoration-none">
            <span class="fs-4">AI简历分析系统</span>
        </div>
        <hr>
        <ul class="nav nav-pills flex-column mb-auto">
            <li class="nav-item">
                <a th:href="@{/admin/interview_admin}" class="nav-link active">
                    <i class="bi bi-speedometer2"></i>
                    控制面板
                </a>
            </li>
            <li>
                <a th:href="@{/admin/users}" class="nav-link">
                    <i class="bi bi-people"></i>
                    用户管理
                </a>
            </li>
            <li>
                <a th:href="@{/admin/profile}" class="nav-link">
                    <i class="bi bi-person"></i>
                    个人资料
                </a>
            </li>
            <li>
                <a th:href="@{/admin/setup}" class="nav-link">
                    <i class="bi bi-gear"></i>
                    系统设置
                </a>
            </li>
            <li>
                <a th:href="@{/interview}" class="nav-link">
                    <i class="bi bi-file-earmark-text"></i>
                    简历分析
                </a>
            </li>
        </ul>
    </div>

    <!-- 主内容区 -->
    <div class="flex-grow-1">
        <!-- 顶部导航栏 -->
        <nav class="topbar mb-4 static-top shadow">
            <div class="container-fluid d-flex justify-content-end align-items-center h-100">
                <div class="d-flex align-items-center">
                    <div class="me-3">
                        <span class="text-dark" th:text="${currentUser.username} + ' (' + ${currentUser.email} + ')'"></span>
                    </div>
                    <div class="dropdown">
                        <a href="#" class="d-flex align-items-center text-decoration-none dropdown-toggle" id="dropdownUser" data-bs-toggle="dropdown" aria-expanded="false">
                            <img th:if="${currentUser.avatarUrl}" th:src="@{${currentUser.avatarUrl}}" class="user-avatar">
                            <div th:unless="${currentUser.avatarUrl}" class="user-avatar bg-primary text-white d-flex align-items-center justify-content-center">
                                <span th:text="${currentUser.email?.substring(0,1)?.toUpperCase()}"></span>
                            </div>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end shadow" aria-labelledby="dropdownUser">
                            <li><a class="dropdown-item" th:href="@{/admin/profile}">个人资料</a></li>
                            <li><hr class="dropdown-divider"></li>
                            <li><a class="dropdown-item" th:href="@{/logout}">退出登录</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </nav>

        <!-- 内容区 -->
        <div class="content-wrapper">
            <div class="container-fluid">
                <!-- 欢迎标题 -->
                <div class="d-sm-flex align-items-center justify-content-between mb-4">
                    <h1 class="h3 mb-0 text-gray-800">控制面板</h1>
                </div>

                <!-- 统计卡片 -->
                <div class="row mb-4">
                    <div class="col-xl-3 col-md-6 mb-4">
                        <div class="card stat-card primary h-100">
                            <div class="card-body">
                                <div class="stat-number" th:text="${totalUsers}">0</div>
                                <div class="stat-text">总用户数</div>
                            </div>
                        </div>
                    </div>
                    <div class="col-xl-3 col-md-6 mb-4">
                        <div class="card stat-card success h-100">
                            <div class="card-body">
                                <div class="stat-number" th:text="${adminUsers}">0</div>
                                <div class="stat-text">管理员数</div>
                            </div>
                        </div>
                    </div>
                    <div class="col-xl-3 col-md-6 mb-4">
                        <div class="card stat-card warning h-100">
                            <div class="card-body">
                                <div class="stat-number" th:text="${regularUsers}">0</div>
                                <div class="stat-text">普通用户数</div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 功能卡片 -->
                <div class="row">
                    <div class="col-lg-6 mb-4">
                        <div class="card shadow">
                            <div class="card-header py-3">
                                <h6 class="m-0 font-weight-bold text-primary">快速操作</h6>
                            </div>
                            <div class="card-body">
                                <div class="row">
                                    <div class="col-md-6 mb-3">
                                        <a th:href="@{/admin/users/add}" class="btn btn-primary w-100">
                                            <i class="bi bi-person-plus"></i> 添加用户
                                        </a>
                                    </div>
                                    <div class="col-md-6 mb-3">
                                        <a th:href="@{/admin/users}" class="btn btn-success w-100">
                                            <i class="bi bi-list-ul"></i> 用户列表
                                        </a>
                                    </div>
                                    <div class="col-md-6 mb-3">
                                        <a th:href="@{/admin/setup}" class="btn btn-info w-100">
                                            <i class="bi bi-gear"></i> 系统设置
                                        </a>
                                    </div>
                                    <div class="col-md-6 mb-3">
                                        <a th:href="@{/interview}" class="btn btn-warning w-100">
                                            <i class="bi bi-file-earmark-text"></i> 简历分析
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="col-lg-6 mb-4">
                        <div class="card shadow">
                            <div class="card-header py-3">
                                <h6 class="m-0 font-weight-bold text-primary">系统信息</h6>
                            </div>
                            <div class="card-body">
                                <div class="text-center">
                                    <img class="img-fluid px-3 px-sm-4 mt-3 mb-4" style="width: 25rem;" src="/static/images/admin.svg" alt="管理面板">
                                </div>
                                <p>欢迎使用AI简历分析系统管理面板。您可以在这里管理用户账户、查看系统统计信息以及配置系统参数。</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
